//
//  MoreCell.m
//  OrderSeat
//
//  Created by haiming on 13-10-16.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import "MoreCell.h"

@implementation MoreCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setContect:(NSDictionary *)dic row:(int)row
{
    if (row == 0) {
        UILabel *label = (UILabel *)[self viewWithTag:9999];
        label.text = [dic objectForKey:@"title"];
        return;
    }
    
    if (row != 8){
        [self setAllContect:1002 andIconTag:1001 :dic];
    }
    
    if (row == 6) {
        [self setAllContect:2004 andIconTag:2005 :dic];
    }
}

- (void)setAllContect:(int)titleTag andIconTag:(int)iconTag :(NSDictionary *)dic
{
    UILabel *label = (UILabel *)[self viewWithTag:titleTag];
    label.text = [dic objectForKey:@"title"];
    UIImageView *imageView = (UIImageView *)[self viewWithTag:iconTag];
    imageView.image = [UIImage imageNamed:[dic objectForKey:@"imageName"]];
}

- (void)setUpUI:(int)cellRow
{
    UIView *view6001 = (UIView *)[self.contentView viewWithTag:6001];
    UIView *view6002 = (UIView *)[self.contentView viewWithTag:6002];
    UIView *view6003 = (UIView *)[self.contentView viewWithTag:6003];
    [view6001 drawBorder];
    [view6002 drawBorder];
    [view6003 drawBorder];

    if (cellRow == 1) {
        UISwitch *mSwitch = (UISwitch *)[self.contentView viewWithTag:7001];
        [mSwitch addTarget:self action:@selector(swithAction:) forControlEvents:UIControlEventValueChanged];
        mSwitch.hidden = NO;
        mSwitch.left = self.contentView.width - 100;
        mSwitch.on = [AppSetting isOpenNotification];
    }
    
    if (cellRow == 5) {
        UIImageView *imageView = (UIImageView *)[self viewWithTag:3002];
        imageView.hidden = YES;
        [imageView drawBorderWidth:0.6];
    }
}

- (void)swithAction:(id)sender
{
    UISwitch *mSwitch = (UISwitch *)sender;
    [AppSetting setIsOpenNotification:mSwitch.on];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
